package com.example.ui.leftmenu;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.RandomAccessFile;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Timer;

import org.apache.http.client.ClientProtocolException;

import com.example.ui.learn.DownHandler;
import com.example.ui.learn.DownUtils;
import com.hp.hpl.sparta.xpath.ThisNodeTest;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.net.sip.SipAudioCall.Listener;
import android.os.Environment;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

public class DownItem {
	
	
	/**
	  *封装每个下载项的属性 
	  * 
	 **/
	//是否暂停
	public  Boolean isPause=false;
	//是否收藏
	public  Boolean isCollet=false;
	//判断下载状态
	public  Boolean isDowned=false;
	//切換删除按鈕
	public  Boolean isChange=false;
	private Context context;
	private String name;
	private String title;
	private String sub_title;
	private String pic_Url;
	
	public Boolean getIsCollet() {
		return isCollet;
	}
	public void setIsCollet(Boolean isCollet) {
		this.isCollet = isCollet;
	}
	public String getPic_Url() {
		return pic_Url;
	}
	public void setPic_Url(String pic_Url) {
		this.pic_Url = pic_Url;
	}
	private TextView jindu;
	private TextView bai;
	private String url;
	private  int downLoadFileSize=0;
	private  int fileSize=0;
	private DownHandler asyncTask = new DownHandler();
	private Button btn_pause;
	private Button btn_delete;
	private Button btn_continue;
	private Button btn_shiting;
	private String ter_Id;
	private int tag;
	
	public int getTag() {
		return tag;
	}
	public void setTag(int tag) {
		this.tag = tag;
	}
	public String getTer_Id() {
		return ter_Id;
	}
	public void setTer_Id(String ter_Id) {
		this.ter_Id = ter_Id;
	}
	private String colum_Id;
	public String getColum_Id() {
		return colum_Id;
	}
	public void setColum_Id(String colum_Id) {
		this.colum_Id = colum_Id;
	}
	public Button getBtn_shiting() {
		return btn_shiting;
	}
	public void setBtn_shiting(Button btn_shiting) {
		this.btn_shiting = btn_shiting;
	}
	private ProgressBar pd_progressBar;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getSub_title() {
		return sub_title;
	}
	public void setSub_title(String sub_title) {
		this.sub_title = sub_title;
	}

	public TextView getJindu() {
		if(jindu==null){
			jindu=new TextView(context);
		}
		return jindu;
	}
	public void setJindu(TextView jindu) {
		this.jindu = jindu;
	}
	public TextView getBai() {
		if(bai==null){
			bai=new TextView(context);
		}
		return bai;
	}
	public void setBai(TextView bai) {
		this.bai = bai;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public int getDownLoadFileSize() {
		return downLoadFileSize;
	}
	public void setDownLoadFileSize(int downLoadFileSize) {
		this.downLoadFileSize = downLoadFileSize;
	}
	public int getFileSize() {
		return fileSize;
	}
	public void setFileSize(int fileSize) {
		this.fileSize = fileSize;
	}
	public DownHandler getAsyncTask() {
		return asyncTask;
	}
	public void setAsyncTask(DownHandler asyncTask) {
		this.asyncTask = asyncTask;
	}
	public Button getBtn_pause() {
		if(btn_pause==null){
			btn_pause=new Button(context);
		}
		return btn_pause;
	}
	public void setBtn_pause(Button btn_pause) {
		this.btn_pause = btn_pause;
	}
	public Button getBtn_delete() {
		if(btn_delete==null){
			btn_delete=new Button(context);
		}
		return btn_delete;
	}
	public void setBtn_delete(Button btn_delete) {
		this.btn_delete = btn_delete;
	}
	public Button getBtn_continue() {
		if(btn_continue==null){
			btn_continue=new Button(context);
		}
		return btn_continue;
	}
	public void setBtn_continue(Button btn_continue) {
		this.btn_continue = btn_continue;
	}
	public ProgressBar getPd_progressBar() {
		if(pd_progressBar==null){
			pd_progressBar=new ProgressBar(context);
		}
		return pd_progressBar;
	}
	public void setPd_progressBar(ProgressBar pd_progressBar) {
		this.pd_progressBar = pd_progressBar;
	}
	
	public DownItem(Context context){
		this.context=context;
	}
	
	public DownItem(){
		this.context=context;
		
	}
	@SuppressWarnings("static-access")
	
	/**
	 * 暂停下载
	 */
	public void pause()
	{
		isPause = true;
		Log.d("debug","paused------------"+isPause);
	}
	/**
	 * 继续下载
	 */
	public void continued()
	{
		isPause =false;
		Log.d("debug","paused------------"+isPause);
	}
	public boolean getIsDowned() {
		
		return this.isDowned;
	}
	public void setIsDowned(Boolean avg) {
		this.isDowned=avg;
	}
	public void setTeacher_pic(String url2) {
		// TODO Auto-generated method stub
		
	}
	
}
